﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace PoolGame2.Assets
{
    public class TextureDatabase
    {
        private Dictionary<string, Texture2D> textureDB;
        private PoolGame parent;

        public TextureDatabase(PoolGame game)
        {
            parent = game;
            textureDB = new Dictionary<string, Texture2D>(20);
        }

        public Texture2D GetTexture(string textureFile)
        {
            if (textureDB.ContainsKey(textureFile))
            {
                return textureDB[textureFile];
            }

            Texture2D loaded = parent.Content.Load<Texture2D>("textures/" + textureFile);
            textureDB.Add(textureFile, loaded);
            return loaded;
        }

    }
}
